<html>
<head>
<#assign basePath=request.contextPath>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>后台管理系统</title>
<#include "/WEB-INF/views/template/bootMainCss.ftl" parse=true encoding="utf-8">
    <link href="${basePath}/bootstrap/css/form.lzy.css" rel="stylesheet">
    <style>
        .row{ margin: 0;}
        .search{ float: right;}
        .shop-img{ text-align: left; padding-left: 30px;}
        .shop-img img{ float: left; margin-right: 10px;}
        .shop-img span{ display: block;}
        .name{ text-align: left; padding-left: 30px;}
        .name span{ display: block;}
        #tbodyId{ font-size: 13px;}
        #myTable thead{ font-size: 14px;}
        .tab-box{ float: right;}
        .tab-box button.btn{ border-color: #ccc; background-color: #fff; color: #333;}
        .tab-box button:hover, .tab-box button.active{ background-color: #FFBE34; color: #fff; border-color: #FFBE34;}
    </style>
</head>
<body>

<div class="panel panel-lzy">
    <div class="panel-body">
        <h5 class="tips-lzy">操作提示</h5>
        <ul class="tips-list-lzy">
            <li>◆&nbsp;<span>该页面显示了业务员当天的个人订单收益记录和其他收益来源记录。</span></li>
        </ul>
    </div>
</div>

<div class="panel panel-f5">
    <div class="panel-body row">
        <form id="myForm" class="form-inline form-margin-right">
            <input type="hidden" id="userId" name="userId" value="${userId?c}"/>
            <input type="hidden" id="orderTime" name="orderTime" value="${date!}"/>
            <input type="hidden" id="level" name="level" value="1"/>
            <button type="button" class="btn btn-primary" onclick="exportProfitRecord();">导出数据</button>
            <div class="form-group tab-box">
                <button type="button" class="btn active" data-src="/admin/statistics/personalRecordListPage?userId=${userId?c}&date=${date!}">个人订单收益记录</button>
                <button type="button" class="btn" data-src="/admin/statistics/otherRecordListPage?userId=${userId?c}&date=${date!}">其他收益来源记录</button>
            </div>
        </form>
    </div>

    <!-- 分页查询的地址-->
    <div class="panel-body panel-white">
        <div class="table-responsive">
            <table id="myTable"
                   class="table table-hover"
                   data-url="${basePath}/admin/statistics/profitRecord/json"
                   data-pageSize="10,50,100" data-method="GET">
                <thead>
                <!-- 需要循环的字段  对应mapper文件-->
                <tr>
                    <th  data-type="checkbox"></th>
                    <th  data-type="xuhao" width="4%">编号</th>
                    <th  data-field="orderId">订单号</th>
                    <th  data-field="skuName" width="30%">产品名称</th>
                    <th  data-field="orderTime" width="25%">成交时间</th>
                    <th  data-field="profit">收益</th>
                </tr>
                </thead>
                <tbody id="tbodyId">

                </tbody>
            </table>
        </div>
        <!-- 分页条-->
        <div class="row">
            <div align="left" class="col-xs-6">
                <div class="input-group">
                    <span class="input-group-addon" id="pageCount"></span> <select
                        id="pageSize" onchange="search(1)" class="form-control"
                        style="width: 100px"></select>
                </div>
            </div>
            <div align="right" class="col-xs-6">
                <ul class="pagination" id="pagination"></ul>
            </div>
        </div>
    </div>

</div>
<#include "/WEB-INF/views/template/bootMainJs.ftl" parse=true encoding="utf-8">
<script type="text/javascript" src="${basePath}/bootstrap/js/utils.js" type="text/javascript"></script>
<script type="text/javascript" src="${basePath}/bootstrap/plugin/jqPaginator/jqPaginator.js"></script>
<script type="text/javascript" src="${basePath}/bootstrap/plugin/jqPaginator/myPage.js"></script>
<script type="text/javascript">

    $(function(){
        $(".tab-box button").each(function(){
            $(this).click(function(){
                var url = $(this).attr("data-src");
                window.location.href='${basePath}'+url;
            })
        })
    })

    //详情
    function viewMeal(obj){
        var id = obj.name;
        window.location.href='${basePath}/admin/product/classify/view?id='+id;
    }

    //导出
    function exportProfitRecord(){
        layer.confirm('是否确定此操作？', {
            btn: ['确定','取消'] //按钮
        }, function() {
            var userId = $("#userId").val();
            var orderTime = $("#orderTime").val();
            var level = $("#level").val();
            window.location.href='${basePath}/admin/statistics/exportProfitRecord?userId='+userId+"&orderTime="+orderTime+"&level="+level;
        });
    }

</script>
</body>
</html>